package com.detrum;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.detrum.service.DownloadReceiveCall;

public class DeviceUpdateReceiver extends BroadcastReceiver {
    private DeviceUpdateReceiverCall deviceUpdateReceiverCall;

    public void setDeviceUpdateReceiverCall(DeviceUpdateReceiverCall deviceUpdateReceiverCall){
        this.deviceUpdateReceiverCall = deviceUpdateReceiverCall;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if(action.equals("deviceUpdate")){
            int position = intent.getIntExtra("position",0);
            if(deviceUpdateReceiverCall!=null){
                deviceUpdateReceiverCall.deviceUpdate(position);
            }
        }
    }
}
